<div class="page-header settingheading">
  <h4>General Account Settings</h4>
</div>
<?php echo form_open(null, 'id="general_setting_form" class="form-horizontal"'); ?>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">First Name:</label>
		<div class="col-sm-7">
			<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" value="<?=$zapmember['firstname']?>">
		</div>
	</div>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">Last Name:</label>
		<div class="col-sm-7">
			<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" value="<?=$zapmember['lastname']?>">
		</div>
	</div>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">Username:</label>
		<div class="col-sm-7">
			<input type="text" class="form-control" id="username" name="username" placeholder="User Name" value="<?=$zapmember['username']?>">
			<?php echo validation_errors(); ?>
		</div>
		<div class="col-sm-2">
			<span id="status"></span>
		</div>
	</div>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">Email:</label>
		<div class="col-sm-7">
			<input type="text" class="form-control" id="email" name="email" placeholder="Email" value="<?=$zapmember['email']?>">
		</div>
	</div>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">Password:</label>
		<div class="col-sm-7">
			<input type="password" class="form-control" id="password" name="password" value="" autocomplete="off">
		</div>
	</div>
	<div class="form-group">
		<label for="inputName" class="col-sm-3 control-label">Confirm Password:</label>
		<div class="col-sm-7">
			<input type="password" class="form-control" id="cpassword" name="cpassword" value="">
		</div>
	</div>
	
	<div class="alert alert-zap text-right">
		<button type="submit" class="btn btn-primary btn-xs">Save Changes</button>
		<a class="btn btn-primary btn-xs" href="<?php echo base_url(); ?>users/settings"><span>Cancel</span></a>
	</div>
</form>
		
	
<script type="text/javascript">
$(document).ready(function()
{
	$("#username").change(function() 
	{ 
		var username = $("#username").val();
		var msgbox = $("#status");
		if(username.length > 3)
		{
			$.ajax({  
					type: "POST",  
					url: "<?php echo base_url(); ?>ajax/checkusername",  
					data: "username="+ username,
					beforeSend:function(){
						msgbox.html('<img src="<?php echo base_url(); ?>assets/front/img/loader.gif" align="absmiddle">');
					},
					success: function(msg)
					{  
						if(msg == 'OK')
						{ 
							msgbox.html('<img src="<?php echo base_url(); ?>assets/front/img/yes.png" align="absmiddle"> <font color="Green"> Available </font>  ');
						}  
						else  
						{  
							msgbox.html(msg);
						}  
					} 
   
				}); 

		}
		else
		{
			$("#username").addClass("red");
			$("#status").html('<font color="#cc0000">Enter valid User Name</font>');
		}
		return false;
	});
});
</script>